
// 列表数据转化树形

export function transListToTreeData(list, rootValue) {
  const arr = []
  list.forEach(item => {
    if (Number(item.parentId) === rootValue) {
      const children = transListToTreeData(list, item.parentId)
      if (children.length) {
        item.children = children
      }
      arr.push(item)
    }
  })
  return arr
}
